<?php
/**
 * Created by PhpStorm.
 * User: s.utkin
 * Date: 03.02.2015
 * Time: 17:42
 */

namespace Multilang\Panel;


use Multilang\TranslateEntities;

class TabsAction extends \Action {
	protected static $isPublic = true;
	
	public static function pullParams()
	{
		return ['langId'];
	}

	protected function run()
	{
		/** @var string $tabId */
		$tabId = $this->request->id;
		$langId = $this->request->_langId;
		$query = $this->request->filterText;
		$strategy = $this->request->filterType;
		$collectedEntities = $this->request->collectedEntities;

		$content = $this->action('.tab.' . $tabId,
			[
				'items' =>  TranslateEntities::getItemsForTranslate($collectedEntities, $query, $strategy, $langId),
				'langId' => $this->request->_langId,
			]
		);

		$this->response->tabHtml = $content;
	}

}